#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node
{
    double shuLiang;
    double zongJia;  //😅
    double danJia;
} a[1005];
double sum = 0, m = 0;
int n;

bool cmp(node x, node y)
{
    return x.danJia > y.danJia;
}
int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        cin >> a[i].shuLiang;
    for (int i = 0; i < n; i++)
        cin >> a[i].zongJia;
    for (int i = 0; i < n; i++)
    {
        a[i].danJia = (1.0 * a[i].zongJia) / a[i].shuLiang;
    }
    sort(a, a + n, cmp);
    for (int i = 0; i < n; i++)
    {
        if (m >= a[i].shuLiang)
        {
            sum += a[i].zongJia;
            m -= a[i].shuLiang;
        }
        else
        {
            sum += 1.0 * m * a[i].danJia;
            break;
        }
    }
    printf("%.2f\n", sum);
    return 0;
}